#ifndef CDYNAMICROPE_H
#define CDYNAMICROPE_H

/*
CDynamicRope class simulates "ropes". Different sounds, textures, breaking points, mass etc.
*/

#include <irrlicht.h>

//using namespace irr;

namespace MarCore
{

namespace DynamicRope
{

class CDynamicRope : public IGameObject
{

    public:

    //! Constructor
    CDynamicRope( u32 max_joints_, const core::vector3df &start, const core::vector3df &end );

    //! Deconstructor
    ~CDynamicRope();

    //! 'Splits' a segmnet of rope by adding a new one at their midpoint and joining it.
    void splitAndAdd( CDynamicRopeVertex* rvert );

    //! Adds a vertex.
    void addVertex( CDynamicRopeVertex* rvert );

    core::aabbox3df* bbox;

    private:

    u32 max_joints;

    core::list<CDynamicRopeVertex>* joints; //joints of this rope

};

class CDynamicRopeVertex : public IReferenceCounted
{

    public:

    //! Constructor
    CDynamicRopeVertex();

    //! Destructor
    CDynamicRopeVertex();

    private:

    ///@todo This whole class needs revision, work on a dynamic rope system.
    f32 mass; //simple mass
    f32 force_snap_point; //max force, any more than this and the vertex snaps.
    core::vector3df position; //position
    core::vector3df transform; //next time step transform

}; //end class CDynamicRope

}; //end namespace DynamicRope
}; //end namespace MarCore

#endif
